package com.lupus.common;

import java.sql.Connection;
import java.sql.DriverManager;

import org.logicalcobwebs.proxool.configuration.JAXPConfigurator;

public class ConnectionFactory {
	private static String configFile = "com/lupus/config/proxool.xml";
	private static boolean loaded = false;
	public static synchronized Connection getConnection(){
		try{
			if(!loaded){
				JAXPConfigurator.configure(Thread.currentThread().getContextClassLoader().getResource(configFile).getFile(),false);
				Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
				loaded = true;
			}
			return DriverManager.getConnection("proxool.hr");
		}catch(Exception e){
			throw new RuntimeException(e);
		}
	}
}
